/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2022-12-13
 * Time: 11:25
 */
public class TestDemo {
    public class Solution {
        public ListNode FindKthToTail(ListNode head,int k) {
            if(k<=0){
                return null;
            }
            if(head==null){
                return null;
            }
            ListNode fast=head;
            ListNode slow=head;
            while(k-1!=0){
                fast=fast.next;
                if(fast==null){
                    return null;
                }
                k--;
            }
            while(fast.next!=null){
                fast=fast.next;
                slow=slow.next;
            }
            return slow;


        }
    }


}
